package com.tianhui.consignortwofei.mvp.model;

import android.content.Context;

import com.fgs.common.CommonModel;
import com.fgs.common.api.CommonConfig;
import com.fgs.common.progress.ObserverResponseListener;
import com.tianhui.consignortwofei.api.CarrierApiService;
import com.tianhui.consignortwofei.mvp.model.enty.CarrierInfo;

import java.util.Map;

import io.reactivex.ObservableTransformer;

/**
 * @author fgs
 * @date 2021/5/22
 * @description
 **/
public class CarrierModel<T> extends CommonModel<T> {
    /**
     * 承运商列表
     *
     * @param context
     * @param map
     * @param isDialog
     * @param transformer
     * @param observerListener
     */
    public void carrierListModel(Context context, Map<String, String> map, boolean isDialog,
                                ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(CarrierApiService.class).carrierList(map), observerListener, transformer, isDialog, true);
    }


    /**
     * 添加承运商
     *
     * @param context
     * @param carrierInfo
     * @param isDialog
     * @param transformer
     * @param observerListener
     */
    public void carrierAddModel(Context context, CarrierInfo carrierInfo, boolean isDialog,
                                ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(CarrierApiService.class).addCarrier(carrierInfo), observerListener, transformer, isDialog, true);
    }

}
